home *** CD-ROM | disk | FTP | other *** search
/ Celestin Apprentice 2 / Apprentice-Release2.iso / Source Code / Think Class Libraries / Expander / Sample Source / CMain.cp < prev    next >
Encoding:
Text File  |  1994-11-30  |  2.6 KB  |  129 lines  |  [TEXT/KAHL]

  1. #include <Constants.h>
  2. #include <Global.h>
  3. #include <Commands.h>
  4.  
  5. #include <CApplication.h>
  6. #include <CBartender.h>
  7. #include <TBUtilities.h>
  8.  
  9. #include <CExpander.h>
  10. #include <CExpanderLabel.h>
  11. #include <CExpanderList.h>
  12. #include <CExpanderPane.h>
  13. #include <CExpandorama.h>
  14.  
  15. #include "CApp.h"
  16. #include "CMain.h"
  17.  
  18.  
  19. extern CApplication        *gApplication;    /* The application */
  20. extern CDesktop            *gDesktop;
  21. extern CDecorator        *gDecorator;
  22.  
  23.  
  24. TCL_DEFINE_CLASS_D1( CMain, x_CMain );
  25.  
  26.  
  27. CMain :: CMain() : x_CMain()
  28. {
  29.     TCL_END_CONSTRUCTOR
  30. }
  31.  
  32.  
  33. CMain :: ~CMain()
  34. {
  35.     TCL_START_DESTRUCTOR
  36. }
  37.  
  38.  
  39. void CMain :: ICMain( void )
  40. {
  41.     Ix_CMain();
  42. }
  43.  
  44.  
  45. void CMain :: PositionWindow( void )
  46. {
  47.     ;
  48. }
  49.  
  50.  
  51. void CMain :: MakeNewWindow( void )
  52. {
  53.     short        eachLevel1, eachLevel2, eachLevel3;
  54.     short        margin = 5;
  55.     LongRect    aFrame;
  56.  
  57.     itsWindow = TCL_NEW( CWindow, ( 500, FALSE, this ) );
  58.  
  59.     CScrollPane        *aScrollPane = TCL_NEW( CScrollPane, ( itsWindow, this, 0, 0, 0, 0,
  60.                                             sizELASTIC, sizELASTIC, TRUE, TRUE, TRUE) );
  61.     aScrollPane->FitToEnclFrame( TRUE, TRUE );
  62.     aScrollPane->GetInterior( &aFrame );
  63.  
  64.     CExpandorama    *aPanorama = TCL_NEW( CExpandorama, ( aScrollPane, this,
  65.                                           aFrame.right - aFrame.left - ( margin << 1 ),
  66.                                           aFrame.bottom - aFrame.top - ( margin << 1 ),
  67.                                           margin, margin, sizELASTIC, sizELASTIC ) );
  68.     aScrollPane->InstallPanorama( aPanorama );
  69.  
  70.     CExpanderList    *topList = TCL_NEW( CExpanderList, ( aPanorama, this ) );
  71.     topList->IExpander();
  72.     topList->SetLabelSelectable( TRUE );
  73.     topList->SetLabelTextRsrcID( 5000 );
  74.  
  75.     for ( eachLevel1 = 1; eachLevel1 <= 4; ++eachLevel1 ) {
  76.         Str255    buffer;
  77.  
  78.         CExpanderList    *aList = TCL_NEW( CExpanderList, ( topList, this, 0, 0, 20, 0 ) );
  79.         aList->IExpander();
  80.         aList->SetLabelTextRsrcID( 5000 + eachLevel1 );
  81.         aList->SetLabelSelectable( TRUE );
  82.  
  83.         for ( eachLevel2 = 1; eachLevel2 <= 4; ++eachLevel2 ) {
  84.  
  85.             CExpanderList    *aSubList = TCL_NEW( CExpanderList, ( aList, this, 0, 0, 20, 0 ) );
  86.             aSubList->IExpander();
  87.             aSubList->SetLabelSelectable( TRUE );
  88.             aSubList->SetLabelTextRsrcID( 5005 + eachLevel2 );
  89.  
  90.             for ( eachLevel3 = 1; eachLevel3 <= 3; ++eachLevel3 ) {
  91.                 CExpanderList    *aLabel = TCL_NEW( CExpanderList, ( aSubList, this, 0, 0, 20, 0 ) );
  92.                 aLabel->IExpander();
  93.                 aLabel->SetLabelSelectable( TRUE );
  94.                 aLabel->SetLabelTextRsrcID( 5009 + eachLevel3 );
  95.                 
  96.                 aSubList->AppendChild( aLabel );
  97.             }
  98.  
  99.             aList->AppendChild( aSubList );
  100.         }
  101.  
  102.         topList->AppendChild( aList );
  103.     }
  104.  
  105.     aPanorama->AppendChild( topList );
  106.  
  107.     itsGopher = itsMainPane = aPanorama;
  108. }
  109.  
  110.  
  111. void CMain :: MakeNewContents( void )
  112. {
  113.     ;
  114. }
  115.  
  116.  
  117. void CMain :: ContentsToWindow( void )
  118. {
  119.     ;
  120. }
  121.  
  122.  
  123. void CMain :: WindowToContents( void )
  124. {
  125.     ;
  126. }
  127.  
  128.  
  129.